<%@ page pageEncoding="UTF-8"%>
<%@ page import="com.hwhp.service.console.DepartService,com.hwhp.service.console.impl.DepartServiceImpl" %>
<%@ page import="com.hwhp.entity.*"%>
<%@ page import="java.util.*"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%
List<YzUser> list=(List<YzUser> )request.getAttribute("userList");
String deptid=(String)request.getAttribute("deptid");
 %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
	<HEAD>
		<LINK href="<%=basePath%>css/milkwhite.css" type=TEXT/CSS
			rel=StyleSheet></LINK>
		<LINK href="<%=basePath%>css/htmilkwhite.css" type=TEXT/CSS
			rel=StyleSheet></LINK>
		<LINK href="<%=basePath%>css/dhtmlxgrid.css" type=TEXT/CSS
			rel=StyleSheet></LINK>
		<SCRIPT src="<%=basePath%>js/list/dhtmlxcommon.js"
			type=text/javascript></SCRIPT>
		<SCRIPT src="<%=basePath%>js/list/dhtmlxgrid.js" type=text/javascript></SCRIPT>
		<SCRIPT src="<%=basePath%>js/list/dhtmlxgridcell.js"
			type=text/javascript></SCRIPT>
		<SCRIPT src="<%=basePath%>js/list/dhtmlxgrid_start.js"
			type=text/javascript></SCRIPT>
	</HEAD>
	<BODY style="MARGIN: 0px; OVERFLOW: visible">
		<FORM id="formlist" name="formlist" action="" method="post">
			<TABLE height="100%" cellSpacing=0 cellPadding=0 width="100%"
				border=0>
				<TBODY>
					<TR>
						<TD height=20></TD>
						<TD height=20></TD>
						<TD height=20></TD>
					</TR>
					<TR>
						<TD class=middlelinel></TD>
						<TD height=20>
							<!-- 搜索 -->
							<TABLE cellSpacing=0 cellPadding=0 border=0 width="100%">
								<TBODY>
									<TR>
										<TD style="WIDTH: 70px" align=right>
											人员名称:
										</TD>
										<TD style="WIDTH: 80px" align=right>
											<INPUT id=title name=title>
										</TD>
										<TD style="WIDTH: 8px"></TD>
										<TD class=searchheight>
											<TABLE class=button onmouseover="this.className='buthot'"
												onmouseout="this.className='button'" cellSpacing=0
												cellPadding=0 border=0>
												<TBODY>
													<TR onclick=document.forms[0].submit();>
														<TD class=buttoncelerity></TD>
														<TD class=buttonmiddle>
															检索
														</TD>
														<TD class=buttonright></TD>
													</TR>
												</TBODY>
											</TABLE>
										</TD>
										<TD width=5></TD>
										<TD>
											<B>1/0</B> 共
											<B>0</B> 条
										</TD>
										<TD vAlign=top align="right">
											<table border='0' cellpadding='2' cellspacing='0'>
												<tr height="20">
													<td
														style='background-image:url(<%=basePath%>images/button/w_buttoncelerity1.gif);width:22px;'></td>
													<td
														style='background-image:url(<%=basePath%>images/button/w_buttonmiddle1.gif);cursor: hand;' onclick="doAllDispachWin()">
														批量授权
													</td>
													<td
														style='background-image:url(<%=basePath%>images/button/w_buttonright1.gif);width:6px;'></td>
													<td
														style='background-image:url(<%=basePath%>images/button/w_buttondelete1.gif);width:22px;'></td>
													<td
														style='background-image:url(<%=basePath%>images/button/w_buttonmiddle1.gif);cursor: hand;'
														onclick="doDispachWin('')">
														批量清空
													</td>
													<td
														style='background-image:url(<%=basePath%>images/button/w_buttonright1.gif);width:6px;'></td>
												</tr>
											</table>
										</TD>
									</TR>
								</TBODY>
							</TABLE>
						</TD>
						<TD class=middleliner></TD>
					</TR>
					<TR>
						<TD class=middlelinel></TD>
						<TD
							style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; BORDER-BOTTOM: 1px solid"
							vAlign=top>
							<TABLE class=dhtmlxGrid id=gridbox height="100%" width="100%">
								<TBODY>
									<TR>
									    <TD style="width:30">
									       <INPUT class=input3 id=userid_checAllkbox name=userid_checkAllbox value="" type="checkbox" onclick="checkAll(this)">
										</TD>
									    <TD noWrap type="ro" style="width:50">
									         序号
										</TD>
										<TD noWrap type="ro" style="width:150">
											姓名
										</TD>
										<TD noWrap type="ro">
											角色
										</TD>
										<TD noWrap type="ro" style="width:50">
											操作
										</TD>
									</TR>
									<%
									 if(list!=null&&list.size()>0){
									  int i=1;
									  for(YzUser userObj:list){
									 %>
									<TR>
									    <TD noWrap style="width:30">
									       <INPUT class=input3 id=userid_checkbox name=userid_checkbox value="<%=userObj.getUserId() %>" type="checkbox">
										</TD>
									    <TD noWrap align="center">
									       <%=i%>
										</TD>
										<TD noWrap>
										    <%="".equals(userObj.getUserName())?"无":userObj.getUserName() %>
										</TD>
										<TD noWrap>
										    <%="".equals(userObj.getRole())?"无":userObj.getRole() %>
										</TD>
										<TD noWrap align="center">
											<img src="<%=basePath%>images/button/assign.gif" style="cursor: hand" onclick="doDispachWin('<%=userObj.getUserId() %>')">&nbsp;&nbsp;
										</TD>
									</TR>
									<%
									 i++;
									 }
									 }else{
									 %>
									 
									 <%
									 }
									  %>
								</TBODY>
							</TABLE>
						</TD>
					<TD class=middleliner></TD>
					</TR>
					<TR>
						<TD class=middlebottoml></TD>
						<TD class=middlebottomm></TD>
						<TD class=middlebottomr></TD>
					</TR>
				</TBODY>
			</TABLE>
			<input type="hidden" name="useridSet" id="useridSet"  value=""> 
			<input type="hidden" name="deptid" id="deptid"  value="<%=deptid %>"> 
		</FORM>
	</BODY>
	<SCRIPT type=text/javascript>
		function editProcess(userid,deptid){
		  formlist.action="/chis/manager/user!userEdit.action?deptid="+deptid+"&userid="+userid+"&act=edit";
		  formlist.submit();
		}
		
		function deleteProcess(userid,deptid){
		  formlist.action="/chis/manager/user!deleteUser.action?deptid="+deptid+"&userid="+userid;
		  formlist.submit();
		}
		
		function doDispachWin(userid){
	          var peopleid = showModalDialog("/chis/manager/role!userDistributeEdit.action?select=one&userid="+userid+"&Random="+Math.random(),"选项分配","dialogHeight:340px;dialogLeft:490px;dialogWidth:500px;dialogTop:250px;help=0;status=0;");
	          if(typeof(peopleid)=="undefined") return;
	            if(peopleid=="true"){
	               document.formlist.action="/chis/manager/role!userDistributeList.action";
	               formlist.submit();
	            };
         }
         
         function doAllDispachWin(){
		      var useridSet=document.getElementsByName("userid_checkbox");
		      var useridStrSet='';
		      for(var i=0;i<useridSet.length;i++){
		         if(useridSet[i].checked){
		         useridStrSet=useridStrSet+",'"+useridSet[i].value+"'";
		         }
		      }
		      if(useridStrSet!=''){
		        useridStrSet=useridStrSet.substring(1);
		         var peopleid = showModalDialog("/chis/manager/role!userDistributeEdit.action?select=all&useridset="+useridStrSet+"&Random="+Math.random(),"选项分配","dialogHeight:340px;dialogLeft:490px;dialogWidth:500px;dialogTop:250px;help=0;status=0;");
	            if(typeof(peopleid)=="undefined") return;
	            if(peopleid=="true"){
	               document.formlist.action="/chis/manager/role!userDistributeList.action";
	               formlist.submit();
	            };
		      }else{
		         alert("请选择需要授权的用户！");
                    return false;
		      }
         }
         
         function checkAll(obj){
              var useridSet=document.getElementsByName("userid_checkbox");
		      for(var i=0;i<useridSet.length;i++){
		         useridSet[i].checked=obj.checked;
		      }
         }
	</SCRIPT>
</HTML>
